<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<?php
$id=$_GET['id'];
// echo $id;
$hostname="127.0.0.1";
$username="root";
$password="123456";
$database="mysql123";

$connet=mysqli_connect($hostname, $username, $password, $database);
mysqli_set_charset($connet, "utf-8");

$sql="select * from user_inf where uid=$id ";
$result=mysqli_query($connet,$sql);
//查询该ID下的用户信息
?>

<?php
if(mysqli_num_rows($result)==0){
    //判断该结果集的行数是否为0条。
echo "该用户不存在";
}else{
    echo "用户栏数：".mysqli_num_rows($result);
    $row= mysqli_fetch_array($result);
    //该结果集的某一行内容赋给$row
}
?>




<html>
    <head>
        <meta charset="UTF-8">
        <title>更新用户信息</title>
    </head>
    <body>
        <?php
        // put your code here



        ?>
    <form action="edituser.php?id=<?php echo $id ?>" method="post" enctype="multipart/form-data">
        头像：<img src="<?php echo $row["ipx"]?>" style="height: 100px;width: 100px";><br/>
        
        更改头像:<input type="file" name="ipx" /> <br/>
        用户名：<input type="text" name="uname" value="<?php echo $row["uname"];?>"/><br/>
        年龄：
           <select name="age">
                <?php
                    for($i=0;$i<=120;$i++){
                      if($i==$row["age"]){
                            echo "<option selected=\"selected\">$i</option>";
                     }else{
                         echo "<option>$i</option>";
                      }

                     }
                  ?>
            </select>
        <input type="submit" value="确认修改">
        <input type="reset" value="重置">
        


    </form>
    








    <?php mysqli_close($connet);?>

    </body>
</html>